package com.gwl.pattern.builder;

import java.util.List;

public abstract class CarModel {

	public static final String KEY_STEP_START = "start"; 
	public static final String KEY_STEP_ENGINE_BOOM = "engineBoom"; 
	public static final String KEY_STEP_ALAM = "alam"; 
	public static final String KEY_STEP_STOP = "stop"; 
	
	private List<String> sequence; 
	
	
	protected abstract void start(); 
	protected abstract void engineBoom(); 
	protected abstract void alam(); 
	protected abstract void stop(); 

	public final void run() { 
		if(sequence != null) { 
			for(String step: sequence) { 
				if(KEY_STEP_START.equals(step)) { 
					this.start(); 
				} else if(KEY_STEP_ENGINE_BOOM.equals(step)) { 
					this.engineBoom(); 
				} else if(KEY_STEP_ALAM.equals(step)) { 
					this.alam(); 
				} else if(KEY_STEP_STOP.equals(step)) { 
					this.stop(); 
				}
			}
		}
	} 
	
	public final void setSequence(List<String> sequence) { 
		this.sequence = sequence; 
	}
	
}
